<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>添加压缩机维修报表</title>
<script>
	function formatDate(v) {
		if (typeof v == 'string')
			v = parseDate(v);
		if (v instanceof Date) {
			var y = v.getFullYear();
			var m = v.getMonth() + 1;
			var d = v.getDate();
			var h = v.getHours();
			return y + '-' + m + '-' + d;
		}
		return '';
	}

	function markAsFinished(button, id) {
		document.getElementById(id).value = formatDate(new Date());
		button.disabled = true;
	}
</script>

<script>
	$(function() {
		$("#datepicker1").datepicker({
			dateFormat : 'yy-mm-dd',
			beforeShow : function(input, inst) {
				inst.dpDiv.css({
					marginTop : -input.offsetHeight + 'px',
					marginLeft : input.offsetWidth + 5 + 'px'
				});
			}
		});
	});

	$(function() {
		$("#datepicker2").datepicker({
			dateFormat : 'yy-mm-dd',
			beforeShow : function(input, inst) {
				inst.dpDiv.css({
					marginTop : -input.offsetHeight + 'px',
					marginLeft : input.offsetWidth + 5 + 'px'
				});
			}
		});
	});

	$(document).ready(function() {
		$("#inputForm").validate({
			rules: {
				SN:"required",
				PN:"required"
			}
		});
	});
</script>
</head>

<body>
	<form:form id="inputForm" modelAttribute="report"
		action="${ctx}/report/back/save/${report.id}" method="post">
		<input type="hidden" name="id" value="${report.id}" />
		<form:hidden path="updateByPersion" value="${report.id}" />
		<fieldset class="prepend-top">
			<legend>添加备泵出入库记录</legend>
			<h4><font color="red">*</font> 为必填项</h4>
			<c:if test="${empty add}">
				<div>
					<label for="uid" class="field">ID:</label> <input
						disabled="disabled" type="text" id="uid" name="uid" size="40"
						value="${report.reportId}" />
				</div>
			</c:if>
			<div>
				<label for="typeNumber" class="field">型号:</label> <input
					type="text" id="typeNumber" name="typeNumber" size="40"
					value="${report.typeNumber}" />
			</div>
			<div>
				<label for="SN" class="field">SN:<font color="red">*</font></label> 
				<input type="text" id="SN" name="SN" size="40" value="${report.SN}" />
			</div>
			<div>
				<label for="PN" class="field">P/N:<font color="red">*</font></label> 
				<input type="text" id="PN" name="PN" size="40" value="${report.PN}" />
			</div>
			<div>
				<label for="status" class="field">状态:</label> 
				<input type="text" id="status" name="status" size="40" value="${report.status}" />
			</div>
			<div>
				<label for="notifier" class="field">通知人:</label> 
				<input type="text" id="notifier" name="notifier" size="40" value="${report.notifier}" />
			</div>
			<div>
				<label for="notifyDate" class="field">通知时间:</label> 
				<input type="text" id="datepicker1" name="notifyDate" size="40" 
					value="<bean:write format="yyyy-MM-dd" name="report" property="notifyDate"/>" />
				格式：yyyy-MM-dd
			</div>
			<div>
				<label for="loader" class="field">提货人:</label> 
				<input type="text" id="loader" name="loader" size="40" value="${report.notifier}" />
			</div>
			<div>
				<label for="loadDate" class="field">提货时间:</label> 
				<input type="text" id="datepicker2" name="loadDate" size="40" 
					value="<bean:write format="yyyy-MM-dd" name="report" property="loadDate"/>" />
				格式：yyyy-MM-dd
			</div>
			<div>
				<label for="customerName" class="field">客户名称:</label> <select
					style="width: 300px" id="customerName" name="customerName" size="1">
					<c:forEach var="customer" items="${customers}">
						<option value="${customer.name}"
							<c:if test="${report.customerName == customer.name }">selected="selected"
						</c:if>>${customer.name}</option>
					</c:forEach>
				</select>
			</div>
			<div>
				<label for="exchangeSN" class="field">换回S/N:</label> 
				<input type="text" id="exchangeSN" name="exchangeSN" size="40" value="${report.exchangeSN}" />
			</div>
			<div>
				<label for="exchangePN" class="field">换回P/N:</label> 
				<input type="text" id="exchangePN" name="exchangePN" size="40" value="${report.exchangePN}" />
			</div>
			<div>
				<label for="comment" class="field">备注:</label> <input type="text"
					id="comment" name="comment" size="40" value="${report.comment}" />
			</div>
			<c:if test="${empty add}">
				<div>
					<label for="updateTime" class="field">更新时间:</label> <input
						disabled="disabled" type="text" id="updateTime" name="updateTime"
						size="40"
						value="<bean:write format="yyyy-MM-dd" name="report" property="updateTime"/>" />
				</div>
				<!-- <div>
					<label for="updateByPersion" class="field">更新人员:</label> <input
						disabled="disabled" type="text" id="updateByPersion"
						name="updateByPersion" size="40" value="${report.updateByPersion}" />
				</div> -->
			</c:if>
		</fieldset>
		<div>
			<input id="submit" class="button" type="submit" value="提交" />&nbsp;
			<input id="cancel" class="button" type="button" value="返回"
				onclick="history.back()" />
		</div>
	</form:form>
</body>
</html>
